package com.smart.redis;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
 * 
* @ClassName: PropertiesUtil 
* @Description: TODO  properties工具类-用来获取配置文件信息
* @Company:e-smart.top
* @author Thinkpad 
* @version 1.0 2018年9月3日 下午2:36:45
 */
public class PropertiesUtil {

    private static Properties endpoints;

    private static void loadProperties() {
        if (endpoints == null) {
            try {
                Properties properties = new Properties();
                InputStream inputStream = PropertiesUtil.class.getClassLoader().getResourceAsStream("redis.properties");
                properties.load(inputStream);
                endpoints = properties;
            } catch (IOException e) {
            	e.printStackTrace();
            }
        }
    }

    public static String get(String key) {
        loadProperties();
        return endpoints.getProperty(key);
    }
}
